import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { SysProfitSettlementForm, SysProfitSettlementQuery, SysProfitSettlementVo } from '@/api/system/model/profitSettlementModel';
import { request } from '@/utils/request';

/**
 * 查询分佣结算列表
 * @param query 查询参数
 */
export function listProfitSettlement(query?: SysProfitSettlementQuery) {
  return request.get<TableDataInfo<SysProfitSettlementVo>>({
    url: '/system/profitSettlement/list',
    params: query,
  });
}

/**
 * 查询分佣结算详细
 * @param settlementId 主键
 */
export function getProfitSettlement(settlementId: string) {
  return request.get<R<SysProfitSettlementVo>>({
    url: `/system/profitSettlement/${settlementId}`,
  });
}

/**
 * 新增分佣结算
 * @param data 表单数据
 */
export function addProfitSettlement(data: SysProfitSettlementForm) {
  return request.post<R<void>>({
    url: '/system/profitSettlement',
    data,
  });
}

/**
 * 修改分佣结算
 * @param data
 */
export function updateProfitSettlement(data: SysProfitSettlementForm) {
  return request.put<R<void>>({
    url: '/system/profitSettlement',
    data,
  });
}

/**
 * 删除分佣结算
 * @param settlementIds 主键串
 */
export function delProfitSettlement(settlementIds: string | Array<string>) {
  return request.delete<R<void>>({
    url: `/system/profitSettlement/${settlementIds}`,
  });
}
